
<h1>Listing documents</h1>
<%= link_to 'New Document', new_document_path %>
<%= render :partial=> 'layouts/datatable'%>
<table id="list_table" cellpadding="5" cellspacing="0" border="2" width="100%">
  <thead>
    <tr>
      <th>Title</th>
      <th>Description</th>
      <th>Download</th>
      <th></th>
      <th></th>
      <th></th>
      </tr>
  </thead>
  <tbody>

<% @documents.each do |document| %>
  <tr>
    <td><%= document.title %></td>
    <td><%= document.description %></td>

    <td><%= link_to 'Download' , download_document_path(document)  if !document.attachment_file_name.blank?  %></td>
    <td><%= link_to 'Show', document %></td>
    <td><%= link_to 'Edit', edit_document_path(document) %></td>
    <td><%= link_to 'Destroy', document, confirm: 'Are you sure?', method: :delete %></td>
  </tr>
<% end %>
</table>

<br />


